<?php
/* @var $this SiteController */

$this->pageTitle=Yii::app()->name;
?>
<script>
	function getGradeList()
	{
		$('#grade').load('<?php echo Yii::app()->request->baseUrl;?>/notification/getgradelist');
	}
	
	function getMajorList(did)
	{
		$('#major').load('<?php echo Yii::app()->request->baseUrl;?>/notification/getmajorlist?did='+did,getClassList($('#grade').val(),$('#department').val(),$('#major').val()));
	}
	
	function getDepartmentList()
	{
		$('#department').load('<?php echo Yii::app()->request->baseUrl;?>/notification/getdepartmentlist');
	}
	
	function getClassList(gid,did,mid)
	{
		$('#class').load('<?php echo Yii::app()->request->baseUrl;?>/notification/getclasslist?gid='+gid+'&did='+did+'&mid='+mid);
	}
</script>

<div class="container" style="width:650px;height:400px;">
    <div class="jumbotron">
			<form action="<?php echo Yii::app()->request->baseUrl; ?>/site/registNewUser" method="post" accept-charset="utf-8" role="form">
				<div class="container">
					<h2>注册</h2>
					<table class="table">  
						<tr>
							<td><input type="text" name="account" class="form-control" placeholder="账号" required /> </td>
						</tr>
						<tr>
							<td><input type="password" name="password" class="form-control" placeholder="密码" required /></td>
						</tr>  
						<tr>
							<td><input type="password" name="repeatPassword" class="form-control" placeholder="再次输入密码" required title="请与上面保持一致"/></td>
						</tr>
						<tr>
							<td><input type="text" name="name" class="form-control" placeholder="姓名" required /> </td>
						</tr>
						<tr>
							<td><input type="text" name="ID" class="form-control" placeholder="学号/工号" required /> </td>
						</tr>
						<tr>
							<td><input type="text" name="phone" class="form-control" placeholder="手机号" required /> </td>
						</tr>
						<tr>
							<td><input type="text" name="mail" class="form-control" placeholder="电子邮箱" required pattern="^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$"  title="邮箱正确格式：xxx@xxx.xxx"/> </td>
						</tr>
						<tr>
							<td>
								<select id="sex" name="sex" class="form-control" placeholder="性别">
									<option value="0">男</option>
									<option value="1">女</option>
								</select>
							</td>
						</tr>
						<tr>
							<td>
								<select id="grade" name="grade" class="form-control" onchange="getClassList($('#grade').val(),$('#department').val(),$('#major').val())" required>
								</select>
							</td>
						</tr>
						<tr>
							<td>
								<select id="department" name="department" class="form-control" onchange="getMajorList($('#department').val())" required>
								</select>
							</td>
						</tr>
						<tr>
							<td>
								<select id="major" name="major" class="form-control" onchange="getClassList($('#grade').val(),$('#department').val(),this.value)" required>
								</select>
							</td>
						</tr>
						<tr>
							<td>
								<select id="class" name="class" class="form-control" required>
								<option value="">请选择班级</option>
								</select>
							</td>
						</tr>
						<script>
							getGradeList();
							getDepartmentList();
							getMajorList();
						</script>
						<tr>
							<td><input class="btn btn-primary" type="submit" role="button" value="注册"/></td>
							<td><a class="btn btn-success" href="<?php echo Yii::app()->request->baseUrl; ?>/site/index" role="button">返回</a></td> 
						</tr>  
					</table>  
				</div>
			</form>
	</div>
</div>

